package com.gitee.srurl.core.api.impl.duplicate;

import cn.hutool.crypto.SecureUtil;
import com.gitee.srurl.core.annotation.ApiImpl;
import com.gitee.srurl.core.constant.ApiTypeConstant;
import com.gitee.srurl.core.constant.RedisConstant;
import com.gitee.srurl.core.util.redis.RedisBloomUtil;

/**
 * md5检测
 *
 * @author zxw
 * @date 2023/4/19 22:25
 */
@ApiImpl(ApiTypeConstant.DuplicateDetection.MD5)
public class Md5DuplicateDetection extends CacheDuplicateDetectionTemplate {

    @Override
    protected boolean cacheContains(String url) {
        return RedisBloomUtil.contains(RedisConstant.Bloom.BLOOM_DUPLICATE_MD5, SecureUtil.md5(url));
    }
}
